<template>
  <view class="section-detail flexc">
    <view class="flex1 over mb70">
      <view class="header mb16">
        <view class="header-t">
          {{ detailObj.detail.user_name }}{{ actionTitle[type] }}
        </view>
        <view class="flex-between">
          <view class="">
            <view class="mb42" v-if="detailObj.detail.date">
              服务日期：{{ detailObj.detail.date }}
            </view>
            <view
              :class="[
                detailObj.detail.status == 1 ||
                detailObj.detail.status == 2 ||
                detailObj.detail.status == 4 ||
                detailObj.detail.status == 6
                  ? 'header-des'
                  : detailObj.detail.status == 8
                  ? 'header-ac'
                  : 'header-ac4',
              ]">
              {{ detailObj.detail.status_name }}
            </view>
          </view>
          <image
            v-if="detailObj.detail.status == 8"
            class="s-icon"
            src="/static/order/s-icon.png"
            mode="aspectFit"></image>
        </view>
      </view>
      <template v-if="type == 5 || type == 6">
        <view class="wrap mb16">
          <view class="box" @click="showDateBtn(0)">
            <view class="">生产日期</view>
            <view class="box-des flex">
              <input
                class="flex1"
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-model="detailObj.detail.production_date" />
              <image
                v-show="!disabled"
                src="/static/login/pop-arrow.png"
                mode="aspectFit"
                class="arrow"></image>
            </view>
          </view>
        </view>
        <view class="wrap mb16">
          <view class="box">
            <view class="">第几车/次</view>
            <view class="box-des">
              <input
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-model="detailObj.detail.train_number" />
            </view>
          </view>
        </view>
      </template>
      <template v-if="type == 9">
        <view class="wrap mb16">
          <view class="box" @click="showDateBtn(0)">
            <view class="">生产日期</view>
            <view class="box-des flex">
              <input
                class="flex1"
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-model="detailObj.detail.service_time" />
              <image
                v-show="!disabled"
                src="/static/login/pop-arrow.png"
                mode="aspectFit"
                class="arrow"></image>
            </view>
          </view>
        </view>
        <view class="wrap mb16">
          <view class="box">
            <view class="">日加工总数</view>
            <view class="box-des">
              <input
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-model="detailObj.detail.total" />
            </view>
          </view>
        </view>
      </template>
      <template v-if="type == 3">
        <view class="wrap mb16">
          <view class="box" @click="showDateBtn(0)">
            <view class="">计划生产日期</view>
            <view class="box-des flex">
              <input
                class="flex1"
                disabled
                type="number"
                placeholder="请输入"
                v-model="detailObj.detail.plan_date" />
              <image
                v-show="!disabled"
                src="/static/login/pop-arrow.png"
                mode="aspectFit"
                class="arrow"></image>
            </view>
          </view>
        </view>
      </template>
      <template v-if="type == 10">
        <view class="wrap mb16">
          <view class="box" @click="showDateBtn(0)">
            <view class="">入库日期</view>
            <view class="box-des flex">
              <input
                class="flex1"
                disabled
                type="number"
                placeholder="请输入"
                v-model="detailObj.detail.warehousing_time" />
              <image
                v-show="!disabled"
                src="/static/login/pop-arrow.png"
                mode="aspectFit"
                class="arrow"></image>
            </view>
          </view>
        </view>
        <view class="wrap mb16">
          <view class="box">
            <view class="">编号</view>
            <view class="box-des">
              <input
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-model="detailObj.detail.production_section_five_no" />
            </view>
          </view>
        </view>
      </template>
      <template v-if="type == 11">
        <view class="wrap mb16">
          <view class="box" @click="showDateBtn">
            <view class="">抽检日期</view>
            <view class="box-des flex">
              <input
                class="flex1"
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-model="detailObj.detail.production_date" />
              <image
                v-show="!disabled"
                src="/static/login/pop-arrow.png"
                mode="aspectFit"
                class="arrow"></image>
            </view>
          </view>
        </view>
        <view class="wrap mb16">
          <view class="box" @click="showFarmerBtn(0, 3)">
            <view class="">质检人</view>
            <view class="box-des flex">
              <input
                class="flex1"
                disabled
                type="text"
                placeholder="请选择"
                v-model="detailObj.detail.quality_inspection_title" />
              <image
                v-show="!disabled"
                src="/static/login/pop-arrow.png"
                mode="aspectFit"
                class="arrow"></image>
            </view>
          </view>
        </view>
      </template>
      <template v-if="type < 5 && type != 3">
        <view class="wrap mb16">
          <view class="box" v-for="(item, index) in arrList" :key="index">
            <view class="">{{ item.title }}</view>
            <view class="box-des flex" @click="showPopBtn(index)">
              <input
                class="flex1"
                :disabled="item.disabled || disabled"
                type="text"
                placeholder="请输入"
                v-model="item.val" />
              <image
                v-if="!disabled && item.check"
                src="/static/login/pop-arrow.png"
                mode="aspectFit"
                class="arrow"></image>
            </view>
          </view>
        </view>
      </template>
      <template
        v-if="
          type == 5 ||
          type == 6 ||
          type == 3 ||
          type == 7 ||
          type == 8 ||
          type == 9 ||
          type == 10 ||
          type == 11
        ">
        <view class="wrap mb16" v-for="(item, index) in arrList" :key="index">
          <view class="box" v-if="type != 9">
            <view class="">序号</view>
            <view class="box-des">
              <input
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-if="item.production_workshop_no"
                v-model="item.production_workshop_no" />
              <input
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-if="item.catch_duck_no"
                v-model="item.catch_duck_no" />
              <input
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-if="item.production_section_four_product_no"
                v-model="item.production_section_four_product_no" />
              <input
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-if="item.production_section_five_no"
                v-model="item.production_section_five_no" />
              <input
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-if="item.production_section_five_spot_check_no"
                v-model="item.production_section_five_spot_check_no" />
              <input
                :disabled="disabled"
                type="number"
                placeholder="请输入"
                v-if="item.production_section_one_sideline_no"
                v-model="item.production_section_one_sideline_no" />
            </view>
          </view>
          <template
            v-if="
              type != 10 && type != 5 && type != 3 && type != 6 && type != 9
            ">
            <view class="box">
              <view class="">生产日期</view>
              <view class="box-des flex">
                <input
                  class="flex1"
                  disabled
                  type="number"
                  placeholder="请输入"
                  v-if="item.pale_date"
                  v-model="item.pale_date" />
                <input
                  disabled
                  class="flex1"
                  type="number"
                  placeholder="请输入"
                  v-if="item.production_date"
                  v-model="item.production_date" />
                <input
                  disabled
                  class="flex1"
                  type="number"
                  placeholder="请输入"
                  v-if="item.produce_date"
                  v-model="item.produce_date" />
                <image
                  v-show="!disabled"
                  src="/static/login/pop-arrow.png"
                  mode="aspectFit"
                  class="arrow"></image>
              </view>
            </view>
          </template>
          <template v-if="type != 5 && type != 3 && type != 6 && type != 9">
            <view class="box" @click="goProductList(index)">
              <view class="">产品名称</view>
              <view class="box-des flex">
                <input
                  class="flex1"
                  disabled
                  type="text"
                  placeholder="请输入"
                  v-model="item.product_title" />
                <image
                  v-show="!disabled"
                  src="/static/login/pop-arrow.png"
                  mode="aspectFit"
                  class="arrow"></image>
              </view>
            </view>
            <template v-if="type == 10 || type == 11">
              <view class="box">
                <view class="">型号</view>
                <view class="box-des">
                  <input
                    disabled
                    type="text"
                    placeholder="请输入"
                    v-model="item.model_number" />
                </view>
              </view>
            </template>
            <view class="box">
              <view class="">规格</view>
              <view class="box-des">
                <input
                  disabled
                  type="text"
                  placeholder="请输入"
                  v-model="item.specifications" />
              </view>
            </view>
            <template v-if="type != 11">
              <view class="box">
                <view class="">数量（件）</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.num" />
                </view>
              </view>
              <view class="box">
                <view class="">重量（kg）</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.weight" />
                </view>
              </view>
            </template>
            <template v-else>
              <view class="box">
                <view class="">个数标准范围</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.num_standard" />
                </view>
              </view>
              <view class="box">
                <view class="">重量标准范围</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.weight_standard" />
                </view>
              </view>
              <view class="box">
                <view class="">抽检件数</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.spot_checks_num" />
                </view>
              </view>
              <view class="box">
                <view class="">个数不达标件数</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.unqualified_num" />
                </view>
              </view>
              <view class="box">
                <view class="">重量不达标件数</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.weight_unqualified_num" />
                </view>
              </view>
              <view class="box">
                <view class="">质量不达标件数</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.quality_unqualified_num" />
                </view>
              </view>
            </template>
          </template>
          <template v-if="type == 5 || type == 6">
            <view class="box" @click="goyzh(index, 0)">
              <view class="">养殖户</view>
              <view class="box-des flex">
                <input
                  class="flex1"
                  disabled
                  type="number"
                  placeholder="请输入"
                  v-model="item.farmer_title" />
                <image
                  v-show="!disabled"
                  src="/static/login/pop-arrow.png"
                  mode="aspectFit"
                  class="arrow"></image>
              </view>
            </view>
            <view class="box">
              <view class="">地点</view>
              <view class="box-des">
                <input
                  disabled
                  type="number"
                  placeholder="请输入"
                  v-model="item.address" />
              </view>
            </view>
            <!-- @click="showFarmerBtn(index, 1)" -->
            <view class="box">
              <view class="">批次</view>
              <view class="box-des flex">
                <input
                  class="flex1"
                  disabled
                  type="number"
                  placeholder="请输入"
                  v-model="item.batch" />
                <image
                  v-show="!disabled"
                  src="/static/login/pop-arrow.png"
                  mode="aspectFit"
                  class="arrow"></image>
              </view>
            </view>
            <view class="box" @click="showFarmerBtn(index, 2)">
              <view class="">车牌号</view>
              <view class="box-des flex">
                <input
                  class="flex1"
                  disabled
                  type="number"
                  placeholder="请输入"
                  v-model="item.plate_number" />
                <image
                  v-show="!disabled"
                  src="/static/login/pop-arrow.png"
                  mode="aspectFit"
                  class="arrow"></image>
              </view>
            </view>
            <template v-if="type == 5">
              <view class="box">
                <view class="">驾驶员</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="text"
                    placeholder="请输入"
                    v-model="item.driver" />
                </view>
              </view>
              <view class="box">
                <view class="">胴体重量(kg)</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.ketone_body_weight" />
                </view>
              </view>
              <view class="box">
                <view class="">生产只数</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.production_num" />
                </view>
              </view>
              <view class="box">
                <view class="">残鸭只数</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.residual_duck" />
                </view>
              </view>
              <view class="box">
                <view class="">残鸭重量(kg)</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.residual_weight" />
                </view>
              </view>
            </template>
            <template v-else>
              <view class="box">
                <view class="">抓伤只数</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.scratch_num" />
                </view>
              </view>
              <view class="box">
                <view class="">斑疮</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.macular_ulcer" />
                </view>
              </view>
              <view class="box">
                <view class="">断翅</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.broken_wing" />
                </view>
              </view>
              <view class="box">
                <view class="">断掌</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.palm" />
                </view>
              </view>
              <view class="box">
                <view class="">红头</view>
                <view class="box-des">
                  <input
                    :disabled="disabled"
                    type="number"
                    placeholder="请输入"
                    v-model="item.red_head" />
                </view>
              </view>
            </template>
          </template>
          <template v-if="type == 9">
            <!-- <detail_commonVue :list="arrList" :disabled="disabled" /> -->
            <view class="box flexc">
              <view class="">序号</view>
              <view class="box-des">
                <input
                  class="flex1"
                  type="number"
                  disabled
                  v-model="item.production_section_four_white_bar_no"
                  placeholder="请输入 不输入自动生成" />
              </view>
            </view>
            <template v-if="item.plate_train_json.length > 0">
              <view class="" v-for="(val, i) in item.plate_train_json" :key="i">
                <view class="box flexc" @click="showFarmerBtn(index, 2, i)">
                  <view class="">车牌号</view>
                  <view class="box-des flex">
                    <input
                      class="flex1"
                      type="text"
                      disabled
                      v-model="val.plate_number"
                      placeholder="请选择" />
                    <image
                      v-show="!disabled"
                      src="/static/login/pop-arrow.png"
                      mode="aspectFit"
                      class="arrow"></image>
                  </view>
                </view>
                <view class="box flexc">
                  <view class="">车次</view>
                  <view class="box-des">
                    <input
                      class="flex1"
                      type="text"
                      :disabled="disabled"
                      v-model="val.train_number"
                      placeholder="请输入,多个使用|隔开 " />
                  </view>
                </view>
              </view>
            </template>
            <view class="box flexc" @click="goyzh(index, 0)">
              <view class="">养殖户</view>

              <view class="box-des flex">
                <input
                  class="flex1"
                  type="number"
                  disabled
                  v-model="item.farmer_title"
                  placeholder="请选择" />
                <image
                  v-show="!disabled"
                  src="/static/login/pop-arrow.png"
                  mode="aspectFit"
                  class="arrow"></image>
              </view>
            </view>
            <!-- @click="showFarmerBtn(index, 1)" -->
            <view class="box flexc">
              <view class="">批次</view>
              <view class="box-des flex">
                <input
                  class="flex1"
                  disabled
                  type="number"
                  placeholder="请输入"
                  v-model="item.batch" />
                <!-- <image
                  v-show="!disabled"
                  src="/static/login/pop-arrow.png"
                  mode="aspectFit"
                  class="arrow"></image> -->
              </view>
            </view>
            <view class="box flexc">
              <view class="">总只数</view>
              <view class="box-des">
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.total"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box flexc">
              <view class="">总重量(kg)</view>
              <view class="box-des">
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.weight"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box flexc">
              <view class="">残鸭只数</view>
              <view class="box-des">
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.residual_duck_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box flexc">
              <view class="">残鸭重量(kg)</view>
              <view class="box-des">
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.residual_duck_weight"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flexc">
              <view class="box1-tip">养殖副品</view>
              <view class="box1-y" v-if="disabled ? true : !showType">
                严重爬背
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'yz_pb')"
                  v-model="item.yz_pb_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.yz_pb_disabled" />
                <view class="x" @click="editListTitle(index, 'yz_pb')">
                  {{ item.yz_pb_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.yz_pb_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.yz_pb_weight"
                placeholder="请输入 " />
            </view>
            <view class="box1 flexc">
              <view class="box1-y" v-if="disabled ? true : !showType">
                断腿/断翅A
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'dt')"
                  v-model="item.dt_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.dt_disabled" />
                <view class="x" @click="editListTitle(index, 'dt')">
                  {{ item.dt_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.dt_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.dt_weight"
                placeholder="请输入 " />
            </view>
            <view class="box1 flexc">
              <view class="box1-tip">抓伤副品</view>
              <view class="box1-y" v-if="disabled ? true : !showType">
                轻微爬背
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'qw_pb')"
                  v-model="item.qw_pb_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.qw_pb_disabled" />
                <view class="x" @click="editListTitle(index, 'qw_pb')">
                  {{ item.qw_pb_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.qw_pb_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.qw_pb_weight"
                placeholder="请输入 " />
            </view>
            <view class="box1 flexc">
              <view class="box1-y" v-if="disabled ? true : !showType">
                抓鸭红头
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'ht')"
                  v-model="item.ht_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.ht_disabled" />
                <view class="x" @click="editListTitle(index, 'ht')">
                  {{ item.ht_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.ht_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.ht_weight"
                placeholder="请输入 " />
            </view>
            <view class="box1 flexc">
              <view class="box1-y" v-if="disabled ? true : !showType">
                淤青红紫
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'yq')"
                  v-model="item.yq_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.yq_disabled" />
                <view class="x" @click="editListTitle(index, 'yq')">
                  {{ item.yq_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.yq_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.yq_weight"
                placeholder="请输入 " />
            </view>
            <view class="box1 flexc">
              <view class="box1-tip">加工副品</view>
              <view class="box1-y" v-if="disabled ? true : !showType">
                断腿/断翅B
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'dt_t')"
                  v-model="item.dt_t_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.dt_t_disabled" />
                <view class="x" @click="editListTitle(index, 'dt_t')">
                  {{ item.dt_t_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.dt_num_t"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.dt_weight_t"
                placeholder="请输入 " />
            </view>
            <view class="box1 flexc">
              <view class="box1-y" v-if="disabled ? true : !showType">
                放血红头
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'fx')"
                  v-model="item.fx_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.fx_disabled" />
                <view class="x" @click="editListTitle(index, 'fx')">
                  {{ item.fx_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.fx_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.fx_weight"
                placeholder="请输入 " />
            </view>
            <view class="box1 flexc">
              <view class="box1-y" v-if="disabled ? true : !showType">
                破皮_机器
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'pp_jq')"
                  v-model="item.pp_jq_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.pp_jq_disabled" />
                <view class="x" @click="editListTitle(index, 'pp_jq')">
                  {{ item.pp_jq_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.pp_jq_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.pp_jq_weight"
                placeholder="请输入 " />
            </view>
            <view class="box1 flexc">
              <view class="box1-y" v-if="disabled ? true : !showType">
                破皮_刀具
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'pp_dj')"
                  v-model="item.pp_dj_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.pp_dj_disabled" />
                <view class="x" @click="editListTitle(index, 'pp_dj')">
                  {{ item.pp_dj_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.pp_dj_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.pp_dj_weight"
                placeholder="请输入 " />
            </view>
            <view class="box1 flexc">
              <view class="box1-y" v-if="disabled ? true : !showType">
                破嘴
              </view>
              <view class="box1-y flex-between" v-else>
                <input
                  type="text"
                  class="flex1"
                  @blur="editListTitle(index, 'pz')"
                  v-model="item.pz_title"
                  placeholder="请输入检验项目名称"
                  :disabled="item.pz_disabled" />
                <view class="x" @click="editListTitle(index, 'pz')">
                  {{ item.pz_disabled ? "修改" : "确认" }}
                </view>
              </view>
              <view class="flex box1-t">
                <view class="">副品数(只)</view>
                <input
                  class="flex1"
                  type="number"
                  :disabled="disabled"
                  v-model="item.pz_num"
                  placeholder="请输入 " />
              </view>
            </view>
            <view class="box1 flex">
              <view class="">副品重量(kg)</view>
              <input
                class="flex1 tr"
                type="number"
                :disabled="disabled"
                v-model="item.pz_weight"
                placeholder="请输入 " />
            </view>
          </template>
          <template v-if="type == 3">
            <view class="box">
              <view class="">只数</view>
              <view class="box-des">
                <input
                  :disabled="disabled"
                  type="number"
                  placeholder="请输入"
                  v-model="item.num" />
              </view>
            </view>
            <view class="box">
              <view class="">规格</view>
              <view class="box-des">
                <input
                  :disabled="disabled"
                  type="number"
                  placeholder="请输入"
                  v-model="item.specifications" />
              </view>
            </view>
            <view class="box">
              <view class="">计划车次</view>
              <view class="box-des">
                <input
                  :disabled="disabled"
                  type="number"
                  placeholder="请输入"
                  v-model="item.planned_train_number" />
              </view>
            </view>
          </template>
        </view>
      </template>

      <view class="wrap mb16">
        <view class="box box2">
          <view class="">备注</view>
          <view class="box-des box-des1">
            <u--textarea
              v-model="detailObj.detail.info"
              height="100"
              border="none"
              :disabled="disabled"
              :count="disabled ? false : true"
              maxlength="200"
              placeholder="请输入"></u--textarea>
          </view>
        </view>
      </view>
      <view class="wrap p-mark">
        <view class="t">流程</view>
        <view
          class="flex p-mark-mb"
          v-for="(item, index) in detailObj.node_list"
          :key="index">
          <view class="avatar-box">
            <image
              :src="item.image || '/static/demo.jpg'"
              mode="aspectFit"
              class="avatar"></image>
            <image
              v-if="item.pass == 2"
              src="/static/order/s.png"
              mode="aspectFit"
              class="icon"></image>
            <image
              v-if="item.pass == 0 || item.pass == 1"
              src="/static/order/w.png"
              mode="aspectFit"
              class="icon"></image>
            <image
              v-if="item.pass == 3"
              src="/static/order/c.png"
              mode="aspectFit"
              class="icon"></image>
            <view class="b-ac" v-if="index < list.length - 1"></view>
          </view>
          <view class="flex1">
            <view class="tip">{{ item.title }}</view>
            <view class="tip-c">
              {{ item.info }}
            </view>
          </view>
          <view class="date" v-if="item.pass == 2">
            {{ item.update_time }}
          </view>
        </view>
      </view>
    </view>
    <view
      class="footer1 flex-between"
      v-if="
        detailObj.detail.status != 9
          ? detailObj.is_edit == 1 && tabCurrent != 1
            ? true
            : detailObj.is_examine != 1
          : false
      ">
      <view class="column-flex-center" @click="goPage(1)">
        <image
          class="edit"
          v-if="detailObj.is_edit == 1"
          src="/static/order/edit.png"
          mode="aspectFit"></image>
        <image
          class="edit"
          v-if="detailObj.is_edit != 1"
          src="/static/order/edit-dis.png"
          mode="aspectFit"></image>
        <view :class="detailObj.is_edit != 1 ? 'dc' : 'back'">修改</view>
      </view>
      <view class="column-flex-center" @click="goPage(2)">
        <image
          class="edit1"
          v-if="detailObj.is_edit == 1"
          src="/static/order/cx.png"
          mode="aspectFit"></image>
        <image
          class="edit1"
          v-if="detailObj.is_edit != 1"
          src="/static/order/cx-dis.png"
          mode="aspectFit"></image>
        <view :class="detailObj.is_edit != 1 ? 'dc' : 'back'">撤销</view>
      </view>
      <view
        class="footer1-btn"
        @click="goPage(3)"
        v-if="detailObj.modification_approval == 1">
        发起修改审批
      </view>
      <view
        :class="['footer1-btn', disabled ? 'gry' : '']"
        @click="goPage(4)"
        v-if="detailObj.modification_approval != 1">
        重新提交
      </view>
    </view>
    <view
      class="footer1 flex-between"
      style="padding-left: 32upx"
      v-if="detailObj.is_examine == 1 && tabCurrent == 1">
      <view class="sh-btn" @click="showPop(0)">拒绝</view>
      <view class="sh-btn" @click="showPop(1)">同意</view>
    </view>
    <!-- 拒绝弹框 -->
    <u-popup :show="show" mode="bottom" round="20">
      <view class="popup-wrap">
        <view class="pop-header" @click="() => (show = false)">
          <image src="/static/order/close.png" mode="aspectFit"></image>
          <text>
            {{ showPopIndex == 0 ? "确认拒绝" : "确认同意" }}
          </text>
        </view>
        <u--textarea
          v-model="mark"
          border="none"
          height="200"
          placeholder="请输入审批意见"></u--textarea>
        <view class="pop-tip">推荐回复</view>
        <view class="flex">
          <view
            class="pop-box"
            v-for="(item, index) in markList"
            :key="index"
            @click="() => (mark = item.info)">
            {{ item.info }}
          </view>
        </view>
        <view class="pop-btn" @click="submitSHbtn">
          {{ showPopIndex == 0 ? "确认拒绝" : "确认同意" }}
        </view>
      </view>
    </u-popup>
    <!-- 产品、养殖户 -->
    <u-picker
      @cancel="() => (showPrick = false)"
      @confirm="confirmPicker"
      :show="showPrick"
      confirmColor="#DA4334"
      :columns="farmerList"
      keyName="title"></u-picker>

    <!-- 生产日期 -->
    <u-calendar
      color="#DA4334"
      @confirm="confirmDate"
      @close="showDate = false"
      :show="showDate"
      :maxDate="maxDate"
      :minDate="minDate"
      :default-date="defaultDate"
      :month-num="12"
      mode="single"></u-calendar>
    <!-- 车牌号 -->
    <u-keyboard
      ref="uKeyboard"
      @change="valChange"
      @backspace="backspace"
      mode="car"
      @confirm="() => (showCar = false)"
      @cancel="() => (showCar = false)"
      :show="showCar"></u-keyboard>
    <!-- 时间选择弹框 -->
    <u-datetime-picker
      :show="showTime1"
      v-model="timeVal"
      :title="showTimeTitle"
      cancelColor="#DA4334"
      confirmColor="#DA4334"
      @confirm="timeBtn"
      @cancel="() => (showTime1 = false)"
      mode="time"></u-datetime-picker>
  </view>
</template>

<script>
import detail_commonVue from "../../../components/order/detail_common.vue";
import {
  farment,
  list,
  list1,
  list2,
  list3,
  list4,
  list5,
} from "../../../plugin/detailListCommon.js";
const d = new Date();
const year = d.getFullYear();
let month = d.getMonth() + 1;
month = month < 10 ? `0${month}` : month;
const date = d.getDate() < 10 ? `0${d.getDate()}` : d.getDate();
const maxDate = new Date(year + 1, 0, 0).getTime();
const minDate = new Date(year, 0, 1).getTime();
const defaultDate = [`${year}-${month}-${date}`];
const monthNum = (year - 2022 + 1) * 12;
export default {
  components: { detail_commonVue },
  data() {
    return {
      monthNum,
      maxDate,
      minDate,
      defaultDate,
      markList: [],
      showTimeTitle: "",
      timeVal: "12:00",
      showTime1: false,
      showCar: false,
      showDate: false,
      disabled: true, //点击修改可以修改
      list: [
        { title: "11", status: 1, name: "333", date: "2012-21-21" },
        { title: "22", status: 2, name: "444", date: "2012-21-21" },
        { title: "33", status: 2, name: "5555", date: "2012-21-21" },
      ],
      actionUrl: {
        1: "/get_seeding_service_log_detail",
        2: "/get_breed_service_log_detail",
        3: "/get_catch_production_log_detail",
        4: "/get_catch_transport_log_detail",
        5: "/get_production_section_one_white_bar_detail",
        6: "/get_production_section_one_sideline_detail",
        7: "/get_production_workshop_detail",
        8: "/get_production_section_four_product_detail",
        9: "/get_production_section_four_white_bar_detail",
        10: "/get_production_section_five_detail",
        11: "/get_production_section_five_spot_check_detail",
      },
      actionTitle: {
        1: "放苗服务记录表",
        2: "养殖服务记录表",
        3: "抓鸭生产计划表",
        4: "抓鸭运输数据记录表",
        5: "白条数据统计",
        6: "抓鸭副品统计",
        7: "副产车间",
        8: "产品数据统计",
        9: "白条副品统计",
        10: "入库成品数据统计",
        11: "产成品合格抽检记录",
      },
      detailObj: {},
      arrList: [],
      type: 0,
      show: false,
      showPopIndex: 0,
      mark: "",
      markList: [],
      farmerList: [],
      farmerList0: [],
      farmerList1: [],
      farmerList2: [],
      farmerList12: {},
      farmerList3: [],
      showPrick: false,
      saveIndex: 0,
      quality_inspection_id: "", //质检人id
      tabCurrent: 0,
      farmerList4: ["大", "中", "小"],
      production_order: [],
      showType: false,
    };
  },
  onLoad(options) {
    console.log("接受参数", options);
    if (Object.keys(options).length > 0) {
      //1---放苗 2--养殖
      this.type = options.type;
      this.id = options.id || ""; //从每个工段跳转过来的
      this.tabCurrent = options?.tabCurrent || 0;
      this.getCommon();
      this.getFarmer();
      if (this.type == 4) {
        this.getSort();
      }
      if (this.type == 9) {
        this.showEditBtn();
      }

      if (this.type == 11) {
        this.getUserList();
      }
      if (
        this.type == 4 ||
        this.type == 5 ||
        this.type == 6 ||
        this.type == 9
      ) {
        this.getPlanNum();
      }
      //需要加type进行调用，只有几个type为几进行调用---this.farmerList()
    }
  },
  onShow() {
    if (uni.getStorageSync("productList")) {
      const { product_title, specifications, product_id } = JSON.parse(
        uni.getStorageSync("productList")
      );
      //产品名称
      this.arrList[this.saveIndex].product_title = product_title ?? "";
      this.arrList[this.saveIndex].product_id = product_id ?? "";
      //规格
      this.arrList[this.saveIndex].specifications = specifications ?? "";
      //型号
      //this.arrList[this.saveIndex].model_number = model_number
      uni.removeStorageSync("productList");
    }
    //养殖户返回，赋值
    if (uni.getStorageSync("checkAddress")) {
      const obj = JSON.parse(uni.getStorageSync("checkAddress"));
      if (this.type < 5) {
        this.arrList[this.saveIndex].val = obj.title;
        this.arrList[this.saveIndex].farmer_id = obj.farmer_id;
        this.arrList[this.saveIndex].farmer_title = obj.title;
        this.arrList[this.saveIndex + 2].address = obj.address;
        this.arrList[this.saveIndex + 2].val = obj.address;
        if (this.type != 4 && this.type != 5) {
          this.arrList[this.saveIndex + 1].val = obj.broker_name;
          this.arrList[this.saveIndex + 1].broker_title = obj.broker_name;
          this.arrList[this.saveIndex + 1].broker_id = obj.broker_id;
        }
      } else {
        this.arrList[this.saveIndex].farmer_title = obj.title;
        this.arrList[this.saveIndex].farmer_id = obj.farmer_id;
        if (this.type != 9) {
          this.arrList[this.saveIndex].address = obj.address;
        }
        if (
          this.type == 9 ||
          this.type == 2 ||
          this.type == 5 ||
          this.type == 6
        ) {
          this.getBatch(obj.farmer_id);
        }
      }
      //this.isyzh = false
      uni.removeStorageSync("checkAddress");
    }
  },
  methods: {
    showEditBtn() {
      this.$api({
        url: "/getUserRoleBySlug",
        method: "get",
        data: {
          slug: "four_white_bar",
        },
      }).then((res) => {
        if (res.code === 200) {
          this.showType = res.data;
        }
      });
    },
    //修改名称
    editListTitle(k, title) {
      console.log("修改----", k);
      this.arrList[k][`${title}_disabled`] =
        !this.arrList[k][`${title}_disabled`];
      if (this.arrList[k][`${title}_disabled`]) {
        if (!this.arrList[k][`${title}_title`]) {
          this.$alert("当前不能为空");
          this.arrList[k][`${title}_disabled`] = false;
          return;
        }
      }
      this.$forceUpdate();
    },
    //获取当天存在的
    getSort() {
      this.$api({
        url: "/getproductionOrder",
        method: "get",
        data: {},
      }).then((res) => {
        if (res.code === 200) {
          this.production_order = res.data.production_order;
        }
      });
    },
    //获取质检人
    getUserList() {
      this.farmerList3 = [];
      this.$api({
        url: "/get_user_list",
        method: "get",
        data: {
          type: "1",
        },
      }).then((res) => {
        if (res.code === 200 && res.data.length > 0) {
          res.data.forEach((item) => {
            item.title = item.real_name;
          });
          this.farmerList3.push(res.data);
        }
      });
    },
    //产品名称跳转
    goProductList(k) {
      this.saveIndex = k;
      this.toRoute("/select-product");
    },
    getPlanNum() {
      this.$api({
        url: "/getFleetList",
        method: "get",
        data: {},
      }).then((res) => {
        console.log(res, "车队信息");
        if (res.code === 200) {
          this.farmerList2.push(res.data.plate_number);
          this.farmerList12 = res.data;
        }
      });
    },
    //type>=5展示的车牌号
    showListCart(index) {
      if (this.disabled) return;
      this.saveIndex = index;
      this.showCar = true;
    },
    backspace() {
      if (this.type >= 5) {
        if (this.arrList[this.saveIndex].plate_number.length) {
          this.arrList[this.saveIndex].plate_number = this.arrList[
            this.saveIndex
          ].plate_number.substr(
            0,
            this.arrList[this.saveIndex].plate_number.length - 1
          );
        }
      } else {
        if (this.arrList[this.saveIndex].val.length) {
          this.arrList[this.saveIndex].val = this.arrList[
            this.saveIndex
          ].val.substr(0, this.arrList[this.saveIndex].val.length - 1);
        }
      }
    },
    valChange(val) {
      if (this.type >= 5) {
        this.arrList[this.saveIndex].plate_number += val;
      } else {
        this.arrList[this.saveIndex].val += val;
      }
    },
    //时间选择确定事件
    timeBtn(e) {
      this.arrList[this.saveIndex].val = e.value;
      this.showTime1 = false;
    },
    //顶部的生产日期
    showDateBtn(k) {
      if (this.disabled) return;
      this.showDate = true;
    },
    goyzh(index) {
      this.saveIndex = index;
      this.toRoute("/select-address?isyzh=1");
    },
    //type==5的养殖户
    showFarmerBtn(index, k, i = 0) {
      if (this.disabled) return;
      // if (k == 0) {
      //   this.farmerList = this.farmerList0;
      // } else if (k == 3) {
      //   //质检人
      //   this.farmerList = this.farmerList2;
      // } else {
      //   //批次
      //   this.farmerList = this.farmerList1;
      // }
      this.farmerList = this["farmerList" + k];
      this.checkIndex = k;
      this.childIndex = i;
      this.saveIndex = index;
      this.showPrick = true;
    },
    showPopBtn(k) {
      const item = this.arrList[k];
      this.saveIndex = k;
      if (
        item.title == "放苗日期" ||
        item.title == "服务日期" ||
        item.title == "计划生产日期" ||
        item.title == "抓鸭日期"
      ) {
        this.showDate = true;
        setTimeout(() => {
          this.showDate = false;
        }, 500);
        setTimeout(() => {
          this.showDate = true;
        }, 500);
      } else if (item.title == "养殖户") {
        // this.showPrick = true;
        // this.farmerList = this.farmerList0;
        this.toRoute("/select-address?isyzh=1");
      } else if (this.type == 2 && item.title == "批次") {
        this.showPrick = true;
        this.farmerList = this.farmerList1;
      } else if (this.type == 4 && item.title == "车牌号") {
        this.showFarmerBtn(k, 2);
      } else if (
        this.type == 4 &&
        (item.title == "到达基地时间" || item.title == "到达工厂时间")
      ) {
        this.showTime1 = true;
        this.showTimeTitle = item.title;
      } else if (this.type == 4 && item.title == "生产排序") {
        console.log(item.title, "11111");
        this.showPrick = true;
        const targetSet = new Set(this.production_order);
        const missingNumbers = Array.from(
          { length: 100 },
          (_, i) => i + 1
        ).filter((num) => !targetSet.has(num));
        this.farmerList = [missingNumbers];
      } else if (this.type == 4 && item.title == "鸭规格") {
        this.showPrick = true;
        this.farmerList = [this.farmerList4];
      }
    },
    //日期的确定事件
    confirmDate(e) {
      console.log("riqi ", e);
      if (this.type == 5 || this.type == 6 || this.type == 11) {
        this.detailObj.detail.production_date = e[0];
      } else if (this.type == 9 || this.type == 10) {
        this.detailObj.detail.service_time = e[0];
      } else if (this.type == 3) {
        this.detailObj.detail.plan_date = e[0];
      } else {
        this.arrList[this.saveIndex].val = e[0];
        //this.arrList[this.saveIndex].seeding_date = e[0];
        if (this.type == 2 && this.arrList[this.saveIndex].val) {
          const date = new Date(e[0]) - new Date(this.arrList[5].batch_title);
          this.arrList[7].day_age = date / (1000 * 60 * 60 * 24);
          this.arrList[7].val = date / (1000 * 60 * 60 * 24);
        }
      }
      this.showDate = false;
    },
    //养殖户，产品名称确认弹框
    confirmPicker(e) {
      console.log("养殖户 ", e);
      if (this.type >= 5) {
        if (this.checkIndex == 0) {
          //养殖户
          this.arrList[this.saveIndex].farmer_title = e.value[0].title;
          this.arrList[this.saveIndex].farmer_id = e.value[0].farmer_id;

          if (this.type != 9) {
            this.arrList[this.saveIndex].address = e.value[0].address;
          }
        } else if (this.checkIndex == 3) {
          //质检人
          this.detailObj.detail.quality_inspection_title = e.value[0].title;
          this.quality_inspection_id = e.value[0].user_id;
        } else if (this.checkIndex == 2) {
          //车牌号
          this.arrList[this.saveIndex].plate_train_json[
            this.childIndex
          ].plate_number = e.value[0].title;
          if (this.type == 5) {
            this.arrList[this.saveIndex].driver =
              this.farmerList12.captain_name.filter(
                (item) => item.title == e.value[0].title
              )[0].value;
          }
        } else {
          //批次
          this.arrList[this.saveIndex].batch = e.value[0].batch;
        }
      } else {
        if (this.type == 4 && this.arrList[this.saveIndex].title == "车牌号") {
          this.arrList[this.saveIndex].val = e.value[0].title;
          this.arrList[this.saveIndex + 1].val =
            this.farmerList12.captain_name.filter(
              (item) => item.title == e.value[0].title
            )[0].value;
        } else if (
          this.arrList[this.saveIndex].title == "生产排序" ||
          this.arrList[this.saveIndex].title == "鸭规格"
        ) {
          this.arrList[this.saveIndex].val = e.value[0];
        } else if (this.arrList[this.saveIndex].title == "批次") {
          this.arrList[this.saveIndex].val = e.value[0].title;
          this.arrList[this.saveIndex].batch = e.value[0].batch;
          this.arrList[this.saveIndex].batch_title = e.value[0].seeding_date;
          if (this.arrList[1].service_date) {
            const date =
              new Date(this.arrList[1].service_date) -
              new Date(e.value[0].seeding_date);
            this.arrList[this.saveIndex + 2].day_age =
              date / (1000 * 60 * 60 * 24);
            this.arrList[this.saveIndex + 2].val = date / (1000 * 60 * 60 * 24);
          }
        } else {
          this.arrList[this.saveIndex].val = e.value[0].title;
          this.arrList[this.saveIndex].farmer_id = e.value[0].farmer_id;
          this.arrList[this.saveIndex].farmer_title = e.value[0].title;

          if (this.type != 4 && this.type != 5) {
            this.arrList[this.saveIndex + 1].val = e.value[0].broker_name;
            this.arrList[this.saveIndex + 1].broker_title =
              e.value[0].broker_name;
            this.arrList[this.saveIndex + 1].broker_id = e.value[0].broker_id;
          }

          this.arrList[this.saveIndex + 2].address = e.value[0].address;
          this.arrList[this.saveIndex + 2].val = e.value[0].address;
        }
      }
      this.showPrick = false;
    },
    //获取养殖户列表
    getFarmer() {
      this.farmerList0 = [];
      this.$api({
        url: "/farmer_list",
        method: "get",
      }).then((res) => {
        if (res.code == 200) {
          this.farmerList0.push(res.data);
        }
      });
    },
    //获取批次
    getBatch(farmer_id = "") {
      this.farmerList1 = [];
      this.$api({
        url: "/batch_list",
        method: "get",
        data: { farmer_id },
      }).then((res) => {
        if (res.code === 200 && res.data.length > 0) {
          res.data.forEach((item) => {
            item.title = item.batch;
          });
          this.farmerList1.push(res.data);
          if (
            this.type == 9 ||
            this.type == 2 ||
            this.type == 5 ||
            this.type == 6
          ) {
            this.arrList[this.saveIndex].batch = res.data[0].batch;
            this.arrList[this.saveIndex].batch_title = res.data[0].batch;
            this.arrList[this.saveIndex].val = res.data[0].batch;
          }
        } else if (
          this.type == 9 ||
          this.type == 2 ||
          this.type == 5 ||
          this.type == 6
        ) {
          this.arrList[this.saveIndex].batch = "";
          this.arrList[this.saveIndex].batch_title = "";
          this.arrList[this.saveIndex].val = "";
        }
      });
    },
    //点击同意，拒绝弹框
    showPop(k) {
      const info_type = k == 0 ? "2" : "1";
      this.markList = [];
      this.showPopIndex = k;
      this.$api({
        url: "/getInfo",
        method: "get",
        data: {
          info_type,
        },
      }).then((res) => {
        if (res.code === 200 && res.data.length > 0) {
          this.show = true;
          this.markList = res.data;
        }
      });
    },
    //审核提交
    submitSHbtn() {
      this.$api({
        url: "/change",
        method: "post",
        data: {
          id: this.detailObj.detail.id,
          form_type: this.type,
          status: this.showPopIndex == 0 ? "2" : "1",
          info: this.mark,
        },
      }).then((res) => {
        this.show = false;
        uni.showToast({
          title: res.msg,
          icon: "none",
        });
        setTimeout(() => {
          uni.navigateBack();
        }, 2000);
      });
    },
    //底部三个按钮
    goPage(k) {
      if ((k == 1 || k == 2 || k == 4) && this.detailObj.is_edit != 1) return;

      //撤销
      if (k == 2) {
        this.revoke();
      } else if (k == 1) {
        this.disabled = !this.disabled;
      } else if (k == 3) {
        //发起修改审批
        this.toRoute({
          path: "edit-record",
          query: {
            type: this.type,
            pid: false,
            id: this.id,
          },
        });
      } else {
        this.submitBtn();
      }
    },
    //撤销
    revoke() {
      this.$api({
        url: "/revoke",
        method: "get",
        data: {
          form_type: this.type + "",
          id: this.id,
        },
      }).then((res) => {
        uni.showToast({
          title: res.msg,
          icon: "none",
        });
        setTimeout(() => {
          uni.navigateBack();
        }, 2000);
      });
    },
    //详情接口
    getCommon() {
      this.$api({
        url: this.actionUrl[this.type],
        method: "get",
        data: {
          type: "0",
          id: this.id,
        },
      }).then((res) => {
        if (res.code === 200) {
          const ac = {
            1: list,
            2: list1,
            // 3: list2,
            4: list3,
          };
          if (this.type < 5 && this.type != 3) {
            const detail = JSON.parse(JSON.stringify(res.data.detail));
            this.arrList = farment(detail, ac[this.type]);
            // this.arrList.forEach(item=>{
            // 	if(Object.keys(item).indexOf('broker_id')>-1){
            // 		item.broker_id =
            // 	}
            // })
            console.log("--------1----", this.arrList);
            if (Object.keys(res.data.detail).indexOf("broker_id") > -1) {
              const i = this.arrList.findIndex((item) => item.broker_title);
              i > -1 && (this.arrList[i].broker_id = res.data.detail.broker_id);
            }
            console.log(this.arrList, "----2-----");
          } else {
            this.arrList = res.data.detail.detail;
            if (this.type == 9) {
              this.arrList.forEach((item) => {
                item.yz_pb_disabled = true;
                item.dt_disabled = true;
                item.qw_pb_disabled = true;
                item.ht_disabled = true;
                item.yq_disabled = true;
                item.dt_t_disabled = true;
                item.fx_disable = true;
                item.pp_jq_title = true;
                item.pp_dj_disabled = true;
                item.pz_disabled = true;
              });
            }
          }
          this.detailObj = res.data;
        }
      });
    },
    formatObj(list = [], arr = ["seeding_no"]) {
      return list.reduce((acc, item) => {
        // 遍历 item 的每个属性
        for (const key in item) {
          // 跳过原型链上的属性和 val、title
          if (
            !item.hasOwnProperty(key) ||
            key === "val" ||
            key === "title" ||
            key === "disabled"
          )
            continue;

          // 如果 acc 中已经有了这个属性，则跳过
          if (acc.hasOwnProperty(key)) continue;

          // 对于 seeding_no，我们使用 val 的值
          if (arr.indexOf(key) > -1) {
            acc[key] = item.val;
          } else {
            // 对于其他属性，我们直接使用属性的值
            acc[key] = item[key];
          }
        }
        return acc;
      }, {});
    },
    submitBtn() {
      console.log("点击----", this.type);
      if (this.type == 1) {
        const arr = this.formatObj(this.arrList, [
          "batch",
          "seeding_number",
          "seeding_date",
        ]);

        console.log(arr, "arr-----111-----");
        this.$api({
          url: "/save_seeding_service_log",
          method: "post",
          data: {
            info: this.detailObj.detail.info,
            id: this.detailObj.detail.id,
            ...arr,
          },
        }).then((res) => {
          uni.showToast({
            title: res.msg,
            icon: "none",
          });
          setTimeout(() => {
            uni.navigateBack();
          }, 2000);
        });
      } else if (this.type == 2) {
        const arr = this.formatObj(this.arrList, [
          "breed_num",
          "service_date",
          "dead_num",
          "surplus_material",
          "cost",
          "sampling_number",
          "weight",
          "health_status",
        ]);
        console.log(arr, "arr------222----");
        this.$api({
          url: "/save_breed_service_log",
          method: "post",
          data: {
            ...arr,
            info: this.detailObj.detail.info,
            id: this.detailObj.detail.id,
          },
        }).then((res) => {
          uni.showToast({
            title: res.msg,
            icon: "none",
          });
          setTimeout(() => {
            uni.navigateBack();
          }, 2000);
        });
      } else if (this.type == 3) {
        // const arr = this.formatObj(this.arrList, [
        //   "plan_date",
        //   "num",
        //   "specifications",
        //   "planned_train_number",
        // ]);
        // console.log(arr, "arr------333----");
        this.$api({
          url: "/save_catch_production_log",
          method: "post",
          data: {
            details: JSON.stringify(this.arrList),
            info: this.detailObj.detail.info,
            id: this.detailObj.detail.id,
            plan_date: this.detailObj.detail.plan_date,
          },
        }).then((res) => {
          uni.showToast({
            title: res.msg,
            icon: "none",
          });
          setTimeout(() => {
            uni.navigateBack();
          }, 2000);
        });
      } else if (this.type == 4) {
        const arr = this.formatObj(this.arrList, [
          "catch_duck_date",
          "plate_number",
          "captain_name",
          "arrive_base_time",
          "arrive_factory_time",
          "production_order",
          "specifications",
        ]);
        console.log(arr, "arr------444----");
        this.$api({
          url: "/save_catch_transport_log",
          method: "post",
          data: {
            ...arr,
            info: this.detailObj.detail.info,
            id: this.detailObj.detail.id,
          },
        }).then((res) => {
          uni.showToast({
            title: res.msg,
            icon: "none",
          });
          setTimeout(() => {
            uni.navigateBack();
          }, 2000);
        });
      } else if (this.type == 5 || this.type == 6) {
        const url =
          this.type == 5
            ? "/save_production_section_one_white_bar"
            : "/save_production_section_one_sideline";
        this.$api({
          url,
          method: "post",
          data: {
            details: JSON.stringify(this.arrList),
            info: this.detailObj.detail.info,
            id: this.detailObj.detail.id,
            production_date: this.detailObj.detail.production_date,
            train_number: this.detailObj.detail.train_number,
          },
        }).then((res) => {
          uni.showToast({
            title: res.msg,
            icon: "none",
          });
          setTimeout(() => {
            uni.navigateBack();
          }, 2000);
        });
      } else if (
        this.type == 7 ||
        this.type == 8 ||
        this.type == 9 ||
        this.type == 10 ||
        this.type == 11
      ) {
        const actionUrl = {
          7: "/save_production_workshop",
          8: "/save_production_section_four_product",
          9: "/save_production_section_four_white_bar",
          10: "/save_production_section_five",
          11: "/save_production_section_five_spot_check",
        };
        const params = {
          details: JSON.stringify(this.arrList),
          info: this.detailObj.detail.info,
          id: this.detailObj.detail.id,
        };
        if (this.type == 9) {
          params.service_time = this.detailObj.detail.service_time;
          params.total = this.detailObj.detail.total;
        } else if (this.type == 10) {
          params.service_time = this.detailObj.detail.service_time;
          params.production_section_five_no =
            this.detailObj.detail.production_section_five_no;
        } else if (this.type == 11) {
          params.production_date = this.detailObj.detail.production_date;
          params.quality_inspection_id = this.quality_inspection_id;
        }
        this.$api({
          url: actionUrl[this.type],
          method: "post",
          data: params,
        }).then((res) => {
          uni.showToast({
            title: res.msg,
            icon: "none",
          });
          setTimeout(() => {
            uni.navigateBack();
          }, 2000);
        });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.section-detail {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  ::v-deep .u-popup {
    flex: 0 !important;
  }
  ::v-deep.u-textarea--disabled {
    background: #fff;
  }
  .header {
    padding: 28upx 32upx 38upx;
    font-size: 24rpx;
    color: #8d8d8d;
    background: #ffffff;
    &-t {
      font-weight: bold;
      font-size: 32rpx;
      color: #161616;
      margin-bottom: 20upx;
    }
    .s-icon {
      width: 128upx;
      height: 128upx;
    }
    &-des {
      font-size: 28rpx;
      color: #f17303;
    }
    &-ac {
      font-size: 28rpx;
      color: #0cb18e;
    }
    &-ac4 {
      // .ac4 {
      font-size: 28rpx;
      color: #8d8d8d;
      // }
    }
    .mb42 {
      font-size: 28rpx;
      margin-bottom: 42upx;
    }
  }

  .mb70 {
    padding-top: 20upx;
    padding-bottom: 70upx;
    background: #f5f7f9;
  }
  .mb16 {
    margin-bottom: 16upx;
  }
  .wrap {
    padding: 0 32upx;
    background: #fff;
    .box {
      background: #fff;
      padding: 28upx 0;
      border-bottom: 1rpx solid #e4e4e4;
      font-size: 32rpx;
      color: #a0a0a0;
      &-des {
        font-size: 32rpx;
        color: #171717;
        margin-top: 20upx;
        & > input {
          font-size: 32rpx;
        }
      }
    }
    .box2 {
      box-sizing: border-box;
      height: 356upx;
    }
    .box:last-child {
      border-bottom: none;
    }
    .t {
      font-weight: bold;
      font-size: 32rpx;
      color: #161616;
      margin-bottom: 40upx;
    }
    .avatar-box {
      position: relative;
      width: 68upx;
      height: 68upx;
      margin-right: 22upx;
      .avatar {
        width: 100%;
        height: 100%;
      }
      .icon {
        position: absolute;
        bottom: 0;
        right: 0;
        width: 32upx;
        height: 32upx;
      }
    }
    .tip {
      font-size: 28rpx;
      color: #a0a0a0;
      margin-bottom: 14upx;
    }
    .tip-c {
      font-size: 28rpx;
      color: #171717;
    }
    .date {
      font-size: 24rpx;
      color: #a0a0a0;
    }

    .b-ac {
      position: absolute;
      width: 2rpx;
      height: 56rpx;
      background: #d7d7d7;
      bottom: -76upx;
      left: 50%;
      transform: translateX(-50%);
    }
  }
  .p-mark {
    padding: 28upx 32upx 10upx;
    &-mb {
      margin-bottom: 74upx;
    }
    &-mb:last-child {
      margin-bottom: 52upx;
    }
  }
  .footer {
    padding: 8upx 32upx;
    background: #fff;
    box-shadow: 0rpx -8rpx 20rpx 0rpx rgba(0, 0, 0, 0.0588);
    & > view {
      width: 328rpx;
      height: 80rpx;
      background: #f2f1f6;
      border-radius: 42rpx 42rpx 42rpx 42rpx;
      border: 1rpx solid #eaecee;
      text-align: center;
      line-height: 80upx;
      font-size: 28rpx;
      color: #171717;
    }
    & > view:nth-of-type(2) {
      background: #da4334;
      color: #ffffff;
    }
  }
  .footer1 {
    padding: 8upx 32upx 8upx 70upx;
    background: #fff;
    font-size: 24rpx;
    color: #9f9ea3;
    box-shadow: 0rpx -8rpx 20rpx 0rpx rgba(0, 0, 0, 0.0588);
    .edit {
      width: 37upx;
      height: 37upx;
      margin-bottom: 10upx;
    }
    .edit1 {
      width: 35rpx;
      height: 37rpx;
      margin-bottom: 12upx;
    }
    &-btn {
      width: 372rpx;
      height: 80rpx;
      background: #da4334;
      border-radius: 422rpx 422rpx 422rpx 422rpx;
      border: 1rpx solid #dafbff;
      text-align: center;
      line-height: 80upx;
      font-size: 28rpx;
      color: #ffffff;
    }
    .sh-btn {
      width: 328rpx;
      height: 80rpx;
      background: #f2f1f6;
      border-radius: 42rpx 42rpx 42rpx 42rpx;
      border: 1rpx solid #eaecee;
      text-align: center;
      line-height: 80upx;
      font-size: 28rpx;
      color: #171717;
    }
    .sh-btn:nth-of-type(2) {
      background: #da4334;
      color: #ffffff;
    }
  }
  .popup-wrap {
    padding: 34upx 32upx 0;
    width: 100%;
    box-sizing: border-box;
    .pop-header {
      position: relative;
      font-weight: bold;
      text-align: center;
      font-size: 28rpx;
      color: #181818;
      margin-bottom: 20upx;
      & > image {
        position: absolute;
        width: 32upx;
        height: 32upx;
        left: 30upx;
        top: 50%;
        transform: translateY(-50%);
      }
    }
    .pop-tip {
      font-size: 26rpx;
      color: #737373;
      margin-bottom: 24upx;
      margin-top: 20upx;
    }
    .pop-box {
      padding: 12upx 20upx;
      background: #eaebed;
      border-radius: 6rpx 6rpx 6rpx 6rpx;
      font-size: 26rpx;
      color: #191919;
      margin-right: 18upx;
    }
    .pop-btn {
      height: 80rpx;
      background: #da4334;
      border-radius: 42rpx 42rpx 42rpx 42rpx;
      line-height: 80upx;
      text-align: center;
      margin-top: 106upx;
      font-size: 28rpx;
      color: #ffffff;
    }
  }
  .dc {
    color: #a0a0a0;
  }

  .gry {
    background: #b9b9b9;
    color: #ffffff;
  }
  .arrow {
    width: 12upx;
    height: 21upx;
  }
  .back {
    color: #171717;
  }
  .box1 {
    padding: 28upx 0;
    font-size: 32rpx;
    border-bottom: 1rpx solid #e4e4e4;
    color: #a0a0a0;
    &-tip {
      font-weight: bold;
      font-size: 32rpx;
      color: #161616;
      padding-left: 16upx;
      border-left: 4upx solid #da4334;
      margin-bottom: 30upx;
    }

    &-y {
      font-size: 32rpx;
      color: #f17303;
      margin-bottom: 28upx;
      & > input {
        font-size: 32rpx;
        color: #f17303;
      }
    }
    .x {
      font-size: 32rpx;
      color: #da4334;
      margin-left: 20upx;
    }
    & > input {
      font-size: 32rpx;
      text-align: right;
      color: #171717;
    }
    &-t {
      font-size: 32rpx;
      color: #a0a0a0;

      & > input {
        font-size: 32rpx;
        color: #171717;
        text-align: right;
      }
    }

    ::-webkit-input-placeholder {
      color: #a0a0a0;
    }
  }
}
</style>
